package com.zzyl.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.base.PageResponse;
import com.zzyl.mapper.NursingProjectMapper;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ：zhangheng
 * @date ：Created in 2024/8/23 11:51
 * @description：护理
 * @modified By：
 * @version:
 */
@Service
public class NursingProjectServiceImpl implements NursingProjectService {
    @Autowired
    private NursingProjectMapper nursingProjectMapper;
    @Override
    public PageResponse<NursingProjectVo> getByPage(String name, Integer pageNum, Integer pageSize, Integer status) {
        //返回页码，页面的长度
        PageHelper.startPage(pageNum, pageSize);
        //返回名称跟状态
        Page<NursingProjectVo> page = nursingProjectMapper.selectByPage(name, status);
        //创建一个对象装进容器里面
        PageResponse<NursingProjectVo> pageResponse = new PageResponse(page);
        //把page里面的值装进 pageResponse里面
        pageResponse.setRecords(page.getResult());
        //返回
        return pageResponse;
    }
}